package seven.test_7_25;

import java.util.Scanner;

public class TestMain2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        int n = scanner.nextInt();
        int cur = 0;
        int left = 0;
        int right = 0;
        int max = 0;
        for (int i = 0; i <= str.length(); i++) {
            if(i - cur == n ) {
                String tmp = str.substring(cur,i);
                int count = 0;
                while(tmp.contains("GC")) {
                    int len = tmp.length();
                    tmp = tmp.substring(tmp.indexOf("GC") + 1,len);
                    count++;
                }
                if(count > max) {
                    left = cur;
                    right = i;
                }
                cur++;
            }
        }
        System.out.println(str.substring(left,right));
    }
}
